/* eslint-disable */
export default {
  data() {
    return {
      fileList: [],
      textarea: '',
      // 资产数据
      assetData:[
        {
          contractNo: '0001201911025861',
          assetName: '***楼宇建设',
          assetType: '10',
          assetNorm: '7',
          supplier: '燃气',
          purchaseUnit: '5',
        },
        {
          contractNo: '0001201911025031',
          assetName: '***楼宇建设',
          assetType: '5',
          assetNorm: '2',
          supplier: '燃气',
          purchaseUnit: '7',
        },
        {
          contractNo: '0001201911025031',
          assetName: '***市政建设',
          assetType: '10',
          assetNorm: '7',
          supplier: '临电',
          purchaseUnit: '10',
        },
        {
          contractNo: '0001201911024234',
          assetName: '***市政建设',
          assetType: '10',
          assetNorm: '7',
          supplier: '临水',
          purchaseUnit: '16',
        },
        {
          contractNo: '0001201911024234',
          assetName: '***市政建设',
          assetType: '10',
          assetNorm: '7',
          supplier: '临水',
          purchaseUnit: '16',
        },
        {
          contractNo: '0001201911027165',
          assetName: '***市政建设',
          assetType: '4',
          assetNorm: '1',
          supplier: '临电',
          purchaseUnit: '19',
        },
      ],

      // 资产图片上传
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,

      // 新增资金流弹窗
      dialogAssetAdd:{
        title: '新增施工现场照片',
        status: false,
      },

      // 新增流转记录表单数据
      assetAddFrom:{
        assetName: '',
        personalName: '',
        personalTel: '',
        personalTel1: '',
        assetPhotoa: '',
        
      },

      // 新增资产表单验证
      assetAddRules: {
        // assetName: [
        //   { required: true, message: '', trigger: 'blur' },
        // ],
        personalName: [
          { required: true, message: '请选择节点', trigger: 'change' },
        ],
        personalTel: [
          { required: true, message: '请选择子节点', trigger: 'change' },
        ],
        personalTel1: [
          { required: true, message: '请选择日期', trigger: 'change' },
        ],
        assetPhoto: [
          { required: true, message: '请上传照片', trigger: 'change' },
        ]
      },

      // 资产维修表单
      uerFrom:{
        assetId: '',
        providerName: '',
        providerContact: '',
        providerTel: '',
        reason: '',
      },

      // 资产维修
      dialogAssetUse:{
        title: '资产维修',
        status: false,
      },

      //  资产维修表单验证
      userRules: {
        assetId: [
          { required: true, message: '请输入资产ID', trigger: 'blur' },
        ],
        providerName: [
          { required: true, message: '请输入提供商名称', trigger: 'blur' },
        ],
        providerContact: [
          { required: true, message: '请输入提供商联系人', trigger: 'blur' },
        ],
        providerTel: [
          { required: true, message: '请输入联系方式', trigger: 'blur' },
        ],
        reason: [
          { required: true, message: '请输入维修原因', trigger: 'blur' },
        ],
      },
    }
  },
  mounted() {

  },
  methods: {
    // 资产弹窗
    dialogAsset(row){
      this.assetAddFrom = row
      this.dialogAssetAdd.status = true
    },

    // 资产照片上传
    uploadFuc(){
      this.$message({
        type: 'success',
        message: '上传失败!'
      })
    },
    successFuc(){
      this.$message({
        type: 'success',
        message: '上传成功!'
      })
    },
    handleRemove(file) {
      console.log(file);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },

    // 资产维修弹窗
    dialogUse(row){
      this.uerFrom = {
        assetId: row.contractNo,
        providerName: '',
        providerContact: '',
        providerTel: '',
        reason: '',
      },
      this.dialogAssetUse.status = true
    },

    // 新增资金记录
    assetUse(formName){
      this.$refs[formName].validate((valid) => {
       if (! this.assetAddFrom.assetPhotoa) {
        this.$message({
          type: 'warning',
          message: '照片不能为空!'
        })
        return false;
       }
        if (valid) {
          this.$message({
            type: 'success',
            message: '提交成功!'
          })
          this.dialogAssetUse.status = false
        } else {
          this.$message({
            type: 'warning',
            message: '请填写相关信息!'
          })
          return false;
        }
      });
    },
    handleChange(file, fileList) {
      this.fileList = fileList.slice(-3);
    }

  }
}